home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Musik / Misc / Amster / Source / info.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-27  |  2.1 KB  |  97 lines

  1. /*
  2. ** Information
  3. */
  4.  
  5. #include "include/config.h"
  6.  
  7. #include <stdio.h>
  8. #include <stdarg.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11.  
  12. #include "include/mui.h"
  13. #include <MUI/NListview_mcc.h>
  14.  
  15. #include "include/gui.h"
  16. #include "include/info.h"
  17. #include "include/panel.h"
  18. #include "amster_Cat.h"
  19.  
  20.  
  21. ULONG info_new(struct IClass *cl, Object *obj, struct opSet *msg);
  22.  
  23.  
  24. MUIF info_dispatch(REG(a0) struct IClass *cl,REG(a2) Object *obj,REG(a1) Msg msg)
  25. {
  26.     switch(msg->MethodID) {
  27.         case OM_NEW: return(info_new(cl,obj,(APTR)msg));
  28.         case INFO_MSG:
  29.             {
  30.             struct infodata *data = INST_DATA(cl, obj);
  31.             DoMethod(data->msglist, MUIM_NList_InsertSingle, (char *)((muimsg)msg)->arg1, MUIV_NList_Insert_Bottom);
  32.             set(data->msglist, MUIA_NList_First, MUIV_NList_Active_Bottom);
  33.             return(NULL);
  34.             }
  35.     }
  36.     return(DoSuperMethodA(cl,obj,msg));
  37. }
  38.  
  39.  
  40. ULONG info_new(struct IClass *cl, Object *obj, struct opSet *msg)
  41. {
  42.     struct infodata *data;
  43.     Object *msglist,*clrbut;
  44.  
  45.     if (obj = (Object *)DoSuperNew(cl,obj,
  46.         MUIA_HelpNode, "info",
  47.         WindowContents, VGroup,
  48.             Child, NListviewObject,
  49.                 MUIA_NListview_NList, msglist = NListObject,
  50.                     ReadListFrame,
  51.                     MUIA_NList_Input, FALSE,
  52.                     MUIA_NList_AutoCopyToClip, TRUE,
  53.                     MUIA_NList_TypeSelect, MUIV_NList_TypeSelect_Char,
  54.                     MUIA_NList_ConstructHook, MUIV_NList_ConstructHook_String,
  55.                     MUIA_NList_DestructHook, MUIV_NList_DestructHook_String,
  56.                     MUIA_NList_AutoVisible, TRUE,
  57.                 End,
  58.             End,
  59.             Child, HGroup,
  60.                 Child, HSpace(0),
  61.                 Child, clrbut = SimpleButton(MSG_INFO_CLEAR),
  62.             End,
  63.         End,
  64.         TAG_MORE, msg->ops_AttrList))
  65.     {
  66.         data = INST_DATA(cl,obj);
  67.         data->msglist = msglist;
  68.  
  69.         set(obj,MUIA_Window_ID,MAKE_ID('I','N','F','O'));
  70.         set(obj,MUIA_Window_Title,MSG_INFO_TITLE),
  71.  
  72.         DoMethod(obj,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,gui->iconpanel,1,PANEL_CLOSEDEBUG);
  73.         DoMethod(clrbut,MUIM_Notify,MUIA_Pressed,FALSE,msglist,1,MUIM_NList_Clear);
  74.  
  75.         return((ULONG)obj);
  76.     }
  77.     return(0);
  78. }
  79.  
  80.  
  81. void gui_debug(char *msg)
  82. {
  83.     DoMethod(gui->iwin, INFO_MSG, msg);
  84. }
  85.  
  86.  
  87. void gui_debugf(char *msg, ...)
  88. {
  89.     static char buf[1024];
  90.     va_list ap;
  91.  
  92.     va_start(ap,msg);
  93.     vsprintf(buf,msg,ap);
  94.     va_end(ap);
  95.     gui_debug(buf);
  96. }
  97.